package com.dawn.module.mp.dal.mysql.msgtemplate;

import java.util.*;

import com.dawn.framework.common.pojo.PageResult;
import com.dawn.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.dawn.framework.mybatis.core.mapper.BaseMapperX;
import com.dawn.module.mp.dal.dataobject.msgtemplate.MsgTemplateDO;
import org.apache.ibatis.annotations.Mapper;
import com.dawn.module.mp.controller.admin.msgtemplate.vo.*;

/**
 * 模板消息 Mapper
 *
 * @author mamba 4 left
 */
@Mapper
public interface MsgTemplateMapper extends BaseMapperX<MsgTemplateDO> {

    default PageResult<MsgTemplateDO> selectPage(MsgTemplatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MsgTemplateDO>()
                .eqIfPresent(MsgTemplateDO::getAppid, reqVO.getAppid())
                .eqIfPresent(MsgTemplateDO::getAccountId, reqVO.getAccountId())
                .eqIfPresent(MsgTemplateDO::getTemplateId, reqVO.getTemplateId())
                .likeIfPresent(MsgTemplateDO::getName, reqVO.getName())
                .eqIfPresent(MsgTemplateDO::getTitle, reqVO.getTitle())
                .eqIfPresent(MsgTemplateDO::getContent, reqVO.getContent())
                .eqIfPresent(MsgTemplateDO::getData, reqVO.getData())
                .eqIfPresent(MsgTemplateDO::getUrl, reqVO.getUrl())
                .eqIfPresent(MsgTemplateDO::getMiniprogram, reqVO.getMiniprogram())
                .eqIfPresent(MsgTemplateDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MsgTemplateDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MsgTemplateDO::getId));
    }

}